home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / CIncludes / Time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-13  |  1.6 KB  |  77 lines  |  [TEXT/MPS ]

  1. /*
  2.     Time.h -- Date and time
  3.     
  4.     Copyright Apple Computer,Inc.    1987, 1988
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __TIME.H__
  10. #define __TIME.H__
  11.  
  12. #ifndef __EVENTS__
  13. #include <Events.h>                 /* contains TickCount */
  14. #endif __EVENTS__
  15.  
  16. #ifndef __OSUTILS__
  17. #include <OSUtils.h>                /* Date/time stuff */
  18. #endif __OSUTILS__
  19.  
  20. #ifndef __STDDEF__
  21. #include <StdDef.h>
  22. #endif __STDDEF__
  23.  
  24. /*
  25.  *    Declarations
  26.  */
  27.  
  28. #define CLOCKS_PER_SEC 60
  29. typedef unsigned long int clock_t;
  30. typedef unsigned long int time_t;
  31. struct tm {
  32.     int tm_sec;        /* Seconds after the minute -- [0, 61] */
  33.     int tm_min;        /* Minutes after the hour -- [0, 59] */
  34.     int tm_hour;    /* Hours after midnight -- [0, 23] */
  35.     int tm_mday;    /* Day of the month -- [1, 31] */
  36.     int tm_mon;        /* Months since January -- [0, 11] */
  37.     int tm_year;    /* Years since 1900 */
  38.     int tm_wday;    /* Days since Sunday -- [0, 6] */
  39.     int tm_yday;    /* Days since January 1 -- [0, 365] */
  40.     int tm_isdst;    /* Daylight Savings Time flag */
  41. };
  42.  
  43. #ifdef __safe_link
  44. extern "C" {
  45. #endif
  46.  
  47. /*
  48.  *    Time manipulation functions
  49.  */
  50.  
  51. clock_t clock (void);                /* function */
  52. #define clock() TickCount()            /* macro */
  53.  
  54. double  difftime (time_t time1, time_t time0);        /* function */
  55. #define difftime(time1,time0) ((double)time1 - time0) /* macro */
  56.  
  57. time_t mktime (struct tm *timeptr);
  58. time_t time (time_t *timer);
  59.  
  60.  
  61. /*
  62.  *    Time conversion functions
  63.  */
  64.  
  65. char *asctime (const struct tm *timeptr);
  66. char *ctime (const time_t *timer);
  67. struct tm *gmtime (const time_t *timer);
  68. struct tm *localtime (const time_t *timer);
  69. size_t strftime (char *, size_t,
  70.                  const char *format, const struct tm *timerptr);
  71.  
  72. #ifdef __safe_link
  73. }
  74. #endif
  75.  
  76. #endif __TIME.H__
  77.